using System.Collections;
using System.Collections.Generic;
using System.Linq;
using Lib;
using Lib.Db;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Options;

namespace TestMvc.Controllers {
    [Route ("api/[controller]")]
    public class ValuesController : Controller {
        private TestConfig testConfig;
        private readonly UserRepository _userRespsitory;

        public ValuesController (IOptions<TestConfig> config, UserRepository userRepository) {
            testConfig = config.Value;
            _userRespsitory = userRepository;
        }

        [HttpGet]
        public IEnumerable<UserEntity> Get () {
            var ret = new List<UserEntity>();

            ret.AddRange( _userRespsitory.ListUsers(10));
            ret.Add(_userRespsitory.GetEntity(10));
            return ret;
        }
    }
}